<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<% 
String path=request.getContextPath(); 
String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="<%=basePath%>">
<title>方案配置</title>

<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
</head>

<script type="text/javascript">
	$(document).ready(function() {
		isReadyIframe();
		queryNlifeHealthInform(1);
	});
	
	function isReadyIframe(){
		var iframe = $(window.parent.document).find("#iframe").length;
		if(iframe==0){
			window.location.href="<%=basePath%>index.jsp";
		}
	}
	
	//点击“确定”按钮，选择合作伙伴
	function chooseChannelInfo(){
		var selected = $("input[name='radioChannelInfo']:checked");
		if(selected.length==0){
			$.message("error", "请选择一个合作伙伴");
			return;
		}
		var channelCode = selected.parent().parent().children(" td:eq(1)").html();
		$('#partnerNo').val(channelCode);
		
		closeChannelInfoDiv();
	}
	
	
	
	//为查询健康告知拼接参数
	function queryNlifeHealthInform(pageIndex){
		var prodCode=$.trim($('#prodCode').val());
		var prodName=$.trim($('#prodName').val());
		var healthInformName = $.trim($('#healthInformName').val());
		
		loadNlifeHealthInform({current:pageIndex,size:10,prodCode:prodCode,prodName:prodName,healthInformName:healthInformName});
	}
	
	//点击重置按钮事件
	function resetQueryNlifeHealthInform(){
		$("#queryNlifeHealthInformTable input[type!='button']").val(""); //清空所有输入栏内容
	}
	
	
	//加载健康告知页 
	function loadNlifeHealthInform(param){
		$.openLoading();
		$.ajax({
				url : "<%=path%>/nlifePlanConfig/loadNlifeHealthInform?"+new Date().getTime(),
				type : 'POST',
				async : true,
				dataType:'json',
				data:param,
				success : function(page) {
					$.closeLoading();
					if($.validate(page))return;
					var flag=page.obj 
					var lastbutton = "<a href='javascript:void(0)' onClick='delNlifeHealthInform(this);return false'>删除</a>";
					var tableContent = creatTable("ID@TDH,CORE_PROD_CODE,CORE_PROD_NAME,CONTENT_NAME,LAST_OPERATE_TIME",page,lastbutton);
					var tableObj = $("#nlifeHealthInformTable");
					tableObj.find("tbody").remove();
					tableObj.append(tableContent);
					var strPage = creatChannelPage(param.current,6,page.maxPage,"101");
					var pageDIV = $("#nlifeHealthInformPageDIV");
					pageDIV[0].innerHTML="";
					pageDIV.append(strPage);
				}
			});
	}
	
	function delNlifeHealthInform(obj){
		var id = $(obj).parent('td').parent('tr')[0].childNodes[0].innerHTML;
		$.dialog({
			type: "warn",
			content: "是否确认删除此健康告知 ？",
			onOk: function() {
				$.openLoading();
				$.ajaxFileUpload({
			        url:'<%=path%>/nlifePlanConfig/delNlifeHealthInform',
			        dataType: 'json',
			        data:{id:id},
			        success : function (data){
			        	$.closeLoading();
			        	if(data.result=="error"||data.result=="fail"){
			        		$.dialog({
				    			width: 358,
				    			top:40,
				    			modal:true,
				    			Close:true,
				    			cancel:null,
				    			content: data.message
				    		});
				        	return;
			        	}else{
			        		$.dialog({
				    			width: 358,
				    			top:40,
				    			modal:true,
				    			Close:true,
				    			cancel:null,
				    			content: "删除成功"
				    		});
			        	}
			        	if($.validate(data)) return;
			        }
				});
				$.closeLoading();
			},
		onCancel:function(){
			return ; 
		}
		})	
		
	}
	
	
	//新增健康告知
	function addNlifeHealthInform(){
		//跳转新增页面
		window.location.href='<%=path%>/nlifePlanConfig/toAddNewHealthInform';
		
	}
	
</script>
	
<body>
	<div class="current">
          <table class="current_table_1">
             <tbody>
               <tr class="f2">
                 <td><img src="./images/current_1.jpg"></td>
                 <td class="current_table_1_td">
                   <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                     <span style=" color:#136bab; ">新意健险产品管理
                     <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>方案配置
                     <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>健康告知配置
                 </span>
                 </td>
                 <td><img src="./images/current_3.jpg"></td>
             </tr>
          </tbody>
        </table>
     </div>
	
	<table class="table_02" id="table">
		<tr>
			<td>
				<table class="search_table" id="queryNlifeHealthInformTable">
					<tr height="30px">
						<td width="23%" height="30">产品代码：
							&nbsp;&nbsp;<input name="txt3" id="prodCode" value="" class="input_text" />
						</td>
						<td width="23%" height="30">产品名称：
							&nbsp;<input name="txt3" id="prodName" value="" class="input_text" />
						</td>
						<td width="25%" height="30">健康告知名称：
							<input name="txt3" id="healthInformName" value=""  class="input_text" />
						</td>
						<td width="30%" height="30">
							<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryNlifeHealthInform(1)"/>&nbsp;
							<input type="button" value="重置" onClick="resetQueryNlifeHealthInform()" class="input_button_1" />							
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="search_table">
					<tr height="30px">
						<td width="100%" height="30">
							 <input type="button"  class="input_button_1" id="searchBtn" value="新增" onClick="addNlifeHealthInform()"/>&nbsp;
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table id="nlifeHealthInformTable"  class="content_table_1">
					<thead>
						<tr class="f1">
						  <th style="width:5%;display:none;">产品编号</th>
		                  <th style="width:5%">产品代码</th>
		                  <th style="width:7%">产品名称</th>
		                  <th style="width:6%">健康告知名称</th>
		                  <th style="width:4%">定义时间</th>
		                  <th style="width:4%">操作</th>
		              	</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
				<div id="nlifeHealthInformPageDIV"  class="page"></div>
			</td>
		</tr>
	</table>
</body>
</html>